<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        /* 重置一下 */
        * {
            padding: 0;
            border: 0;
            margin: 0;
            outline: 0;
            box-sizing: border-box;
        }

        /* 搬砖 */
        .MLGB {
            /* height: 500px; */
            background-color: antiquewhite;
        }

        .header {
            display: flex;
            align-items: center;
            height: 50px;
            font-size: 18px;
            padding: 0 10px;
            color: #fff;
            text-align: center;
            background-color: #f97c7c;
        }

        .main {
            display: flex;
        }

        /* 切换菜单的按钮 */
        .toggle-menu {
            height: 30px;
            line-height: 30px;
            text-align: center;
            width: 30px;
            font-size: 14px;
            background-color: #607d8b;
            margin-right: 10px;
        }

        /* 菜单 */
        .menu {
            flex: 0 0 140px;
            background-color: #5ed5e4;
        }

        .menu .li {
            height: 30px;
            line-height: 30px;
            padding: 0 10px;
            border-bottom: 1px solid #91dfe8;
        }

        .nav {
            /* height: 100px; */
            display: flex;
            flex-wrap: wrap;
            flex: 1 1 100%;
        }

        .nav::after {
            content: "";
            display: block;
            height: 0;
            clear: both;
            overflow: hidden;
        }

        .box {
            display: flex;
            justify-content: center;
            flex: 1 1 auto;
            min-width: 160px;
            height: 100px;
            line-height: 100px;
            text-decoration: none;
            font-size: 18px;
            border: 1px solid #ddd;
        }


        /* 媒体查询 */
        @media screen and (min-width: 500px) {
            .header .toggle-menu {
                display: none;
            }
        }

        @media screen and (max-width: 500px) {
            .header .toggle-menu {
                display: block;
            }

            .menu {
                display: none;
            }
        }
    </style>
</head>

<body>
    <div class="MLGB">
        <!-- 头部 -->
        <div class="header">
            <div id="toggle" class="toggle-menu">菜</div>
            <div id="facility">设备</div>
            <div class="title">欢迎大家来到，双十一天猫主会场！</div>
        </div>
        <!-- 主要内容区域 -->
        <div class="main">
            <!-- 左侧菜单 -->
            <div id="menu" class="menu">
                <div class="li">购物车</div>
                <div class="li">我的收藏</div>
                <div class="li">浏览记录</div>
                <div class="li">已经购买</div>
                <div class="li">设置</div>
                <div class="li">退出</div>
            </div>
            <!-- 分会场入口 -->
            <div class="nav">
                <a class="box" href="##">鞋子</a>
                <a class="box" href="##">箱包</a>
                <a class="box" href="##">数码</a>
                <a class="box" href="##">服装</a>
                <a class="box" href="##">乐器</a>
                <a class="box" href="##">户外</a>
                <a class="box" href="##">家具</a>
                <a class="box" href="##">家具</a>
                <a class="box" href="##">影视</a>
                <a class="box" href="##">美食</a>
            </div>
        </div>
    </div>

</body>
<script>
    let toggle = document.querySelector('#toggle');
    let menu = document.querySelector('#menu');
    let facility =document.querySelector('#facility');
    toggle.onclick = function () {
        if (menu.style.display == 'block') {
            menu.style.display = 'none';
        }else{
            menu.style.display = 'block';
        }
    }
    facility.addEventListener('click',()=>{
        console.log(1);
        console.log(navigator.userAgent);
    })
</script>

</html>